package kr.hkit.androidcomplete01.ch06.work;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;

public class Stroke extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(new MyView(this));
	}
	
	class MyView extends View{
		
		private Paint paint;
		
		public MyView(Context context){
			super(context);
			paint=new Paint();
			
		}

		@Override
		protected void onDraw(Canvas canvas) {
			super.onDraw(canvas);
			
			canvas.drawColor(Color.LTGRAY);
			
			//캡모양 테스트
			paint.setColor(Color.BLUE);
			paint.setStrokeWidth(16);
			canvas.drawLine(50, 30, 240, 30, paint);
			paint.setStrokeCap(Paint.Cap.ROUND);
			canvas.drawLine(50,60,240,60,paint);
			paint.setStrokeCap(Paint.Cap.SQUARE);
			canvas.drawLine(50,90,240,90,paint);
			
			
			//조인모양 테스트
			
			paint.setColor(Color.BLACK);
			paint.setStrokeWidth(20);
			paint.setStyle(Paint.Style.STROKE);
			paint.setStrokeJoin(Paint.Join.MITER);
			canvas.drawRect(50, 150, 90, 200, paint);
			paint.setStrokeJoin(Paint.Join.BEVEL);
			canvas.drawRect(120, 150,160,200,paint);
			paint.setStrokeJoin(Paint.Join.ROUND);
			canvas.drawRect(190, 150,230,200,paint);
			
		}
		
		
	}
	
	
}
